package com.my.mvvmrapid.ui.fuction.selector;

import android.os.Bundle;
import android.widget.ArrayAdapter;

import com.my.mvvmrapid.BR;
import com.my.mvvmrapid.R;
import com.my.mvvmrapid.databinding.ActivitySelectorBinding;
import com.zhongjh.mvvmrapid.base.ui.BaseActivity;
import com.zhongjh.mvvmrapid.utils.ScreenUtil;

/**
 * 选择器
 * @author zhongjh
 * @date 2021/4/15
 */
public class SelectorActivity extends BaseActivity<ActivitySelectorBinding, SelectorModel> {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        ScreenUtil.setFullScreen(SelectorActivity.this, false);
        super.onCreate(savedInstanceState);
    }

    @Override
    public int initContentView(Bundle savedInstanceState) {
        return R.layout.activity_selector;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @Override
    public boolean isStartAutoHideSoftKeyboard() {
        return false;
    }

    @Override
    public void initParam() {

    }

    @Override
    public void initData() {
        initToolbar(binding.toolbar, "选择器", true);
        initSpnTest1();
        initSpnTest2();
    }

    private void initSpnTest1() {
        String[] datas = getResources().getStringArray(R.array.week);
        ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(getApplicationContext(),  android.R.layout.simple_spinner_item, datas);
        arrayAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);
        binding.spnTest1.setAdapter(arrayAdapter);
    }

    private void initSpnTest2() {
        String[] datas = getResources().getStringArray(R.array.week);
        ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(getApplicationContext(),  android.R.layout.simple_spinner_item, datas);
        arrayAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);
        binding.spnTest2.setAdapter(arrayAdapter);
    }

    @Override
    public void initViewObservable() {

    }

}
